tasker: Ava Activity state plugin#65
Conversation
|
@brownard I also implemented two tasker actions (and their unit tests) in this branch that stacks on top of this PR. Would you prefer I keep it as a separate PR for later, or push that commit in this PR? Unit-testing that state condition plugin proved tricky, because of the need to inject a |
|
I'm good with this in principle but want to take a bit of care to keep the Tasker stuff as loosely coupled as possible. I'm particularly thinking about the follow on commit that adds a direct dependency in the voice satellite. I intend to refactor the ESPHome implementation slightly to make the voice satellite a component of an ESPHome device, rather than inheriting from it, which should simplify its dependencies, in the process I can add public methods for wake/stop timer/etc which will hopefully mean the Tasker plugin can call those directly without it needing to be internal to the satellite. I'll install Tasker and have a play around. |
|
Cool! I wired up the For actions, I specifically went with simple callback functions to give us flexibility in refactoring the underlying code: we can easily register them from I'm curious about your advice on unit testing. The two actions were easy to unit test by copying from |
|
I have a plan for the refactoring so I will try and get that done first. Regarding the testing you can add an instrumentation test in the androidTest source, like I've done for wake word testing here. These run on your connected device/emulator so give you access to a context, etc, but are obviously a bit slower, and are not currently run on Github. |
|
Thanks for this, I have merged it in as is. I will refactor the voice satellite/device in a later pull request but feel free to open further pull requests with additional actions/conditions and I will work around them. |
This PR adds a first Tasker state plugin, following the doc at https://tasker.joaoapps.com/pluginslibrary.html. Instead of one-big-plugin-per-application, Tasker uses small runners focussed on one thing:
EspHomeStatefor finer-grained automation casesI updated #49 with these possible use cases as the tracking issue.
Some notes:
AvaActivityInputcould be extended in the future, for example with a finer grainedEspHomeStateselection. I went with a less granular "Conversing` option right now, because it's easier to setup and gives us more latitude to modify the app's internals without breaking automationsTASKER.mddocumentation file for discoverability and because this file will probably grow to a half-dozen pluginsUnit, so my first iteration returned the value ofEspHomeStateand the number of timers, but these are a footgun I decided to remove: they are accessible to create conditions on, but these conditions are NOT re-evaluated when the fields changes, only when the state is initially satisfied